﻿using System;
using System.Windows.Forms;

namespace HAOest.Forms.Buttons
{
    /// <summary>
    /// 最大化按钮
    /// </summary>
    public partial class MaximizeButton : SimpleButton
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public MaximizeButton()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 单击方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonPictureBox_Click(object sender, EventArgs e)
        {
            if (this.FindForm().WindowState == FormWindowState.Normal)
            {
                this.FindForm().WindowState = FormWindowState.Maximized;
                ButtonImage = Properties.Resources.restore_0;
                MouseEnterButtonImage = Properties.Resources.restore_1;
            }
            else if (this.FindForm().WindowState == FormWindowState.Maximized)
            {
                this.FindForm().WindowState = FormWindowState.Normal;
                ButtonImage = Properties.Resources.max_0;
                MouseEnterButtonImage = Properties.Resources.max_1;
            }
        }
    }
}
